import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class StatusbarPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    //不适用appbar,适配状态栏高度
    return AnnotatedRegion<SystemUiOverlayStyle>(
      value: SystemUiOverlayStyle.dark,
      child: Scaffold(
        appBar: PreferredSize(
          preferredSize:
              Size.fromHeight(MediaQueryData.fromWindow(window).padding.top),
          child: SafeArea(
            top: true,
            child: Offstage(),
          ),
        ),
        body: _body(),
      ),
    );
  }

  Widget _body() {
    return Container(
      alignment: Alignment.center,
      child: Text('不使用appbar'),
    );
  }
}
